package com.fyd.mybatis.session;

import com.fyd.mybatis.builder.XML.XMLConfigBuilder;
import com.fyd.mybatis.session.defaults.DefaultSqlSessionFactory;

import java.io.Reader;

/**
 * @Description
 * @Auther: fyd20
 * @Date: 2025/6/5 13:51
 * @Description: 构建SqlSessionFactory的工厂
 * @Version 1.0.0
 */
public class SqlSessionFactoryBuilder {

    public SqlSessionFactory build(Reader reader){
        XMLConfigBuilder xmlConfigBuilder = new XMLConfigBuilder(reader);
        return build(xmlConfigBuilder.parse());
    }

    private SqlSessionFactory build(Configuration cofig) {
        return new DefaultSqlSessionFactory(cofig);
    }
}
